#include "3DModelManager.hpp"
#include "3DModel.hpp"

//! Setting values for static variables.
ModelManager*    ModelManager::m_pInstance = 0;

ModelManager* ModelManager::GetInstance()
{
	if(!m_pInstance)
	{
		m_pInstance = new ModelManager;
	}

	return m_pInstance;
}

ModelManager::ModelManager()
{
}

bool ModelManager::IsAlreadyLoaded(const std::string &fileName)
{
	std::map<std::string, void* >::const_iterator filePosition;

	filePosition = m_modelMap.find( fileName );

	if( filePosition == m_modelMap.end() )
		return false;

	return true;
}

bool ModelManager::LoadModel(std::string fileName)
{/*
	if( !IsAlreadyLoaded( fileName ) )
	{
		//! If model specified by filename isn't already in memory then load it.
		Model3D* newModel = new TextureObject( fileName, eTextureType );

		//if( !newTexture->HaveBitmapData() )
		//{
		//	cout << "TextureObject(): error in loading " << fileName << "\n";
		//	return false;
		//}

		m_texMap.insert( std::make_pair( fileName, (void*)newTexture ) );
		newTexture->IncreaseCounter();

		return true;
	}
	else
	{
		//! If texture is already loaded increase it's reference counter.
		map<string, void*>::const_iterator ptr = m_texMap.find( fileName );
		TextureObject* tex = (TextureObject*)ptr->second;
		tex->IncreaseCounter();

		return true;
	}
*/
	return true;
}

//EOF